clear; clc;
%% device prepare
ziCreateAPISession('dev3538', 6);
s=MeasurementSession.SimpleMeasurement();

tek=s.getDevice('tek');

aom = EquipmentControl.ExecutionEquipment.AOM.AA('Pol Beam');
aom.controlledBy(tek, 1);

%%
ziDAQ('setInt', '/dev3538/auxouts/0/outputselect', -1);
ziDAQ('setInt', '/dev3538/auxouts/1/outputselect', -1);

zMag=1.5;
lightOn=1;
delayLight=2;
delayMagnetic=3;



% xMag = 0.73;
% zMag = 0.6;
% xMag = 0.73;
% zMag = 0.6;
% 
% ziDAQ('setDouble', '/dev3538/auxouts/0/offset', xMag);
% ziDAQ('setDouble', '/dev3538/auxouts/1/offset', 0);
% pause(0.1);

% tek.silence();
% wv.shape='SQU';wv.frequency=2e-3;wv.amplitude=5;wv.offset=2.5;
% tek.setWave(1, wv);
% tek.trig_source('EXT');
% tek.setBurstCycle(1, 1);
% tek.BurstModeON(1);
% tek.fire(1);
% tek.forceTrigger

aom.dcON;
ziDAQ('setDouble', '/dev3538/auxouts/1/offset',0);
ziDAQ();
pause(lightOn);
aom.dcOFF;
pause(delayLight);
ziDAQ('setDouble', '/dev3538/auxouts/1/offset',zMag);
pause(delayMagnetic);
ziDAQ();




%ziDAQ('setDouble', '/dev3538/auxouts/1/offset',zMag);


